using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using ShopPowerTemplate.IoC;
using ShopPowerTemplate.Entities;
using ShopPowerTemplate.Services.Tests.Properties;

namespace ShopPowerTemplate.Services.Tests
{
    public partial class ProductServiceUtil
    {
	
		static internal IProductService CreateProductService()
        {
            IProductService target = IoCFactory.Resolve<IProductService>();
            return target;
        }
				#region Product Test
 
        

		public static Product CreateProduct()
        {
            Product result = GetProduct();
            IProductService service = CreateProductService();
			service.Add(result);

			result = service.Find(result.Id);
            return result;
        }
		
		public static Product CreateProductFull()
        {
            Product result = GetProductFull();
            IProductService service = CreateProductService();
			service.Add(result);

			result = service.Find(result.Id);
            return result;
        }
				
        public static Product GetProduct()
        {
            Product result = new Product();
			
            result.Name = Guid.NewGuid().ToString();

            result.Description = Guid.NewGuid().ToString();

            result.Price = Math.Round(((decimal)new Random().NextDouble()), 2, MidpointRounding.ToEven);


            result.Tax = Math.Round(((decimal)new Random().NextDouble()), 2, MidpointRounding.ToEven);


            result.Prominent = true;

        	result.Subcategory = SubcategoryServiceUtil.CreateSubcategory(); 
 
            return result;
            
        }
		
        public static Product GetProductFull()
        {
            Product result = GetProduct();
            
            result.Weight = Math.Round(((decimal)new Random().NextDouble()), 2, MidpointRounding.ToEven);


            result.Discount = Math.Round(((decimal)new Random().NextDouble()), 2, MidpointRounding.ToEven);


            result.IsInactive = true;
 
            return result;
            
        }
		
		#endregion Product Test
	

	}
}
